package OOPS;

abstract class Person0 {
	private String name;

	Person0(String name) {
		this.name = name;
	}

	String getName() {
		return this.name;
	}

	abstract void showWorkInfo();

	abstract String getPersonType();

	static void showMessage() {
		System.out.println("static in Person Chintu");
	}
}

class Service {
	void showPersonInfo(Person0 p) {
		System.out.println("showPerson in service");
		System.out.println(p.getPersonType());
		System.out.println("name\t:" + p.getName());
		p.showWorkInfo();
		p.showMessage();
		// Person.showMessage();
		// System.out.println(p.getSid());
		// System.out.println(p.getEid());
		if (p instanceof Student) {
			Student stud = (Student) p;
			System.out.println("Student Sid\t:" + stud.getSid());
			stud.showMessage();
		} else if (p instanceof Employee) {
			Employee emp = (Employee) p;
			System.out.println("Eid\t:" + emp.getEid());
			emp.showMessage();
			// Employee.showMessage();
		}
	}
}

class Student extends Person0 {
	private int Sid;

	Student(String name, int Sid) {
		super(name);
		this.Sid = Sid;
	}

	void showWorkInfo() {
		System.out.println("__  Student will Study __");
	}

	String getPersonType() {
		return "Type\t:Student";
	}

	int getSid() {
		return this.Sid = Sid;
	}

	static void showMessage() {
		System.out.println("static in Student");
	}
}

class Farmer extends Person0 {
	Farmer(String name) {
		super(name);
	}

	void showWorkInfo() {
		System.out.println("-- Farmer will work in field --");
	}

	String getPersonType() {
		return "Type\t:Farmer";
	}

	static void showMessage() {
		System.out.println("-- static in Farmer --");
	}
}

class Employee extends Person0 {
	String Eid;

	Employee(String name, String Sid) {
		super(name);
		this.Eid = Eid;
	}

	void showWorkInfo() {
		System.out.println("-- Employee will work in company --");
	}

	String getPersonType() {
		return "Type\t:Employee";
	}

	String getEid() {
		return this.Eid;
	}

	static void showMessage() {
		System.out.println("-- static in Employee --");
	}
}

class Test63 {
	public static void main(String st[]) {
		Service se = new Service();
		se.showPersonInfo(new Farmer("Katiyar"));
		se.showPersonInfo(new Student("anil", 34));
		se.showPersonInfo(new Employee("gaurav", "112"));
	}
}